package com.iknow.xmpp.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.iknow.util.Loger;

public class XmppBroadcastReceiver extends BroadcastReceiver
{
  public static final String CONNECTION_ECEPTION = "connection_exception";
  public static final String IKOW_CONNECTION_CLOSED = "IKnowConnectionClosed";
  public static final String RECONNECTION_ATTEMPT = "attempt_to_reconnect";
  public static final String SHUTTING_DOWN = "shutting_down";
  public static final String START_SERVICE_BOOT_COMPLETED = "start_service_boot_completed";
  private final String TAG = "XmppBroadcastReceiver";
  private boolean mbFirst = true;

  public void onReceive(Context paramContext, Intent paramIntent)
  {
    String str = paramIntent.getAction();
    if (str.equalsIgnoreCase("android.net.conn.CONNECTIVITY_CHANGE"))
      if (this.mbFirst)
        this.mbFirst = false;
    while (true)
    {
      do
        while (true)
        {
          return;
          Loger.i("XmppBroadcastReceiver", "网络连接改变，改变用户在线状态");
          paramContext.startService(new Intent("attempt_to_reconnect", null, paramContext, IKnowXmppService.class));
        }
      while (!(str.equalsIgnoreCase("android.intent.action.BOOT_COMPLETED")));
      Loger.i("XmppBroadcastReceiver", "系统启动完毕，启动服务，同时iKnow上线");
      paramContext.startService(new Intent("start_service_boot_completed", null, paramContext, IKnowXmppService.class));
    }
  }
}